package com.ld.controller;

import com.alibaba.druid.pool.DruidDataSource;
import com.ld.pojo.Student;
import com.ld.pojo.Student2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * @Author: Liudao
 * @Date: 2022-08-22-14:48
 * @Description:
 */

@RestController
@RequestMapping
public class HelloController {

    @Autowired
    private Student student;
    @Autowired
    private Student2 student2;
    @Autowired
    private DruidDataSource dataSource;


    @GetMapping("hello")
    public String hello(){
        return "hello";
    }

    @GetMapping("student1")
    public Student student(){
        return student;
    }

    @GetMapping("student2")
    public Student2 student2(){
        return student2;
    }

    @GetMapping("source")
    public String getDataSource(){
     	return dataSource.getUsername() + "|||" + dataSource.getPassword();
     }
}
